#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QDebug>
#include <QPushButton>
#include <QInputDialog>

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    //通过按钮获得到输入框，然后通过用户输入然后把用户输入的浮点型数据打印出来
    QPushButton* button = new QPushButton("获取输入框",this);
    QInputDialog* idlog = new QInputDialog(this);
    connect(button,&QPushButton::clicked,[=](){
        double d = idlog->getDouble(this,"输入框","浮点型数据");
        qDebug() << "输出的数据为: " << d;
    });
}

MainWindow::~MainWindow()
{
    delete ui;
}

